#include "StdAfx.h"
#include "ConfAddFrdCommander.h"
extern struct UserInfo gUserInfo;

ConfAddFrdCommander::ConfAddFrdCommander(void)
{
}

ConfAddFrdCommander::ConfAddFrdCommander( const wstring& FrnUID ):m_FrdUID(FrnUID)
{
}
ConfAddFrdCommander::~ConfAddFrdCommander(void)
{
}

int ConfAddFrdCommander::ProcessCommand()
{
	CMarkup xmlReply;
	xmlReply.AddElem(_T("IPIN")); 
	xmlReply.AddChildElem(_T("Type"), CLIENT_ADD_ALLOW);
	xmlReply.AddChildElem(_T("Info"));
	xmlReply.IntoElem();
	xmlReply.AddChildElem(_T("Name"), gUserInfo.m_UserName.c_str());
	xmlReply.AddChildElem(_T("UID"), gUserInfo.m_UID.c_str());
	xmlReply.AddChildElem(_T("FriendUID"), m_FrdUID.c_str());

	m_Command = xmlReply.GetDoc();

	int CmdRsp = SendCommand(true);
	if (CmdRsp != COMMAND_OK)
	{
		return COMMAND_CONN_ERROR;
	}
	return COMMAND_OK;
}